package Ep04_String.Offer_58;

/**
 * @author Jimmy Zhan WORKSTATION
 * @date 2023/3/21 20:50
 * 说明：剑指offer-58 解法一：StringBuilder分段append
 */

public class Mine {
    public String reverseLeftWords(String s, int n) {
        if (s.length() == 1){
            return s;
        }
        StringBuilder sb = new StringBuilder();
        int k = n;
        while (k < s.length()){
            sb.append(s.charAt(k));
            k++;
        }
        for (int i = 0; i < n; i++) {
            sb.append(s.charAt(i));
        }
        return sb.toString();
    }
}
